package cn.sourcespro.shiro.service.impl;

import cn.sourcespro.shiro.dao.SysPermissionMapper;
import cn.sourcespro.shiro.entity.SysPermission;
import cn.sourcespro.shiro.service.SysPermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * security
 *
 * @author zhanghaowei
 * @date 2018/7/13
 */
@Service
public class SysPermissionServiceImpl implements SysPermissionService {

    @Autowired
    private SysPermissionMapper mapper;

    @Override
    public int delete(Integer id) {
        return mapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(SysPermission record) {
        record.setStatus((byte) 1);
        return mapper.insert(record);
    }

    @Override
    public SysPermission findById(Integer id) {
        return mapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SysPermission> findAll() {
        return mapper.selectAll(null);
    }

    @Override
    public int update(SysPermission record) {
        record.setStatus((byte) 1);
        return mapper.updateByPrimaryKey(record);
    }
}
